package com.leon.ikun.ui.adapters.searchResult;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.leon.ikun.R;
import com.leon.ikun.base.baseAdapter.ViewBindingAdapter;
import com.leon.ikun.beans.home.HomeRecommendApp;
import com.leon.ikun.databinding.ItemVideoBinding;
import com.leon.ikun.ui.activities.publicActivities.VideoActivity;
import com.leon.ikun.utils.ValueUtils;
import com.leon.ikun.utils.ViewUtils;

import java.util.Map;

/**
 * @Author Leon
 * @Time 2022/08/02
 * @Desc
 */
public class SearchResultVideoJisuAdapter extends ViewBindingAdapter<HomeRecommendApp.VodInfo,ItemVideoBinding> {
    public SearchResultVideoJisuAdapter(Context context) {
        super(context);
    }

    @Override
    protected ItemVideoBinding getItemViewBinding(Context context, ViewGroup parent) {
        return ItemVideoBinding.bind(LayoutInflater.from(context).inflate(R.layout.item_video, parent, false));
    }

    @Override
    protected void onBindViewHolder(HomeRecommendApp.VodInfo data, ItemVideoBinding binding, int position) {

        binding.getRoot().setOnClickListener(v -> startActivity(VideoActivity.class, Map.of(VideoActivity.PARAM_TYPE, VideoActivity.TYPE_VIDEO,
                VideoActivity.PARAM_ID, data.getVodId())));

        ViewUtils.setImg(context, binding.cover, data.getVodPic());
        binding.extra.setText(data.getVodDuration());

        binding.title.setText(ValueUtils.keywordTrim(data.getVodName()));
        binding.author.setText(data.getTypeName());
//        binding.view.setText((data.getVodName()));


//        binding.danmaku.setText(data.getVodUp());
//        binding.danmaku.setText(0);
    }


}
